package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BasePageInfo;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.MarketBrand;
import com.cskaoyan.bean.param.CommonData;
import com.cskaoyan.service.wx.WXBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :rain
 * @description ?page=1&limit=10
 * @since 2022/06/28 17:45
 */
@RestController
@RequestMapping("wx/brand")
public class WXBrandController {

    @Autowired
    WXBrandService wxBrandService;

    /**
     * @param info 传入的参数为分页信息，返回的是brand的信息
     * @return
     */
    @RequestMapping("/list")
    public BaseRespVo list(BasePageInfo info) {
        CommonData<MarketBrand> data = wxBrandService.queryAllInfo(info);
        return BaseRespVo.ok(data);
    }

    /**
     * 根据品牌的id查询当前的品牌信息，返回的是当前品牌的对象
     * @param id 当前品牌的id
     * @return
     */
    @RequestMapping("detail")
    public BaseRespVo detail(Integer id) {
        MarketBrand brand = wxBrandService.queryDetailInfo(id);
        return BaseRespVo.ok(brand);
    }
}
